<?
include_once "index.php";


if(isset($submit) && $submit == "Search by name")
{
$q1 = "select * from job_seeker_info where $name_type like '%$name%'  order by $name_type";
$r1 = mysql_query($q1) or die('<center><br><br><br><span class=TNA>Select <b>order by </b> option </span></center>');

	if(mysql_num_rows($r1) == '0')
	{
		echo "<center><br><br><br><span class=BlackLink>No results. </span></center>";
		include_once('../footer.php');
		exit;
	}

echo "<br><br><table align=center width=460 border=1 rules=rows cellspacing=0 cellpadding=5 bordercolor=black class=BlackText>";
echo "<tr class=TableHead bgcolor=#736F6E><td><font color=#FFFFFF> Username </font></td><td><font color=#FFFFFF>Name </font></td> <td align=center><font color=#FFFFFF> Delete </font></td></tr>";
$col = "cococo"; 
while($a1 = mysql_fetch_array($r1))
{
 if($col == "cococo")
	    { 
	     $col = "dddddd"; 
	    }
	         	 else
		{ 
		$col = "cococo"; 
		} 

echo "<tr bgcolor=\"$col\"><td>$a1[uname]</td><td><a class=BlackLink href=\"preview.php?uname=$a1[uname]\"> $a1[fname] $a1[lname] </a></td> <td align=center><a class=TNA href=\"ADR.php?uname=$a1[uname]\">resume</a>|<a class=TNA href=\"ADU.php?uname=$a1[uname]\">user </a></td></tr>";
}

echo "</table>\n";
include_once('../footer.php');
exit;
}

elseif(isset($submit) && $submit == "List users")
{
if (!$ByPage) $ByPage=25;  
if (!$Start) $Start=0; 

$q1 = "select * from job_seeker_info  order by $order_type   limit $Start,$ByPage";
$r1 = mysql_query($q1) or die('<center><br><br><br><span class=TNA>Select <b>order by </b> option </TNA></center>');


echo "<br><table align=center width=460 border=1 rules=rows cellspacing=0 cellpadding=5 bordercolor=black class=BlackText>";
echo "<tr class=TableHead bgcolor=#736F6E><td><font color=#FFFFFF> Username </font></td><td><font color=#FFFFFF>Name </font></td> <td align=center><font color=#FFFFFF> Delete </font></td></tr>";
$col = "cococo"; 
while($a1 = mysql_fetch_array($r1))
{
 if($col == "cococo")
	    { 
	     $col = "dddddd"; 
	    }
	         	 else
		{ 
		$col = "cococo"; 
		} 

echo "<tr bgcolor=\"$col\"><td>$a1[uname]</td><td><a class=BlackLink href=\"preview.php?uname=$a1[uname]\"> $a1[fname] $a1[lname] </a></td> <td align=center><a class=TNA href=\"ADR.php?uname=$a1[uname]\">resume</a>|<a class=TNA href=\"ADU.php?uname=$a1[uname]\">user </a></td></tr>";
}

echo "</table>\n";



$cp = "select count(uname) from job_seeker_info";
$rcp = mysql_query($cp) or die (mysql_error());
$ap = mysql_fetch_array($rcp);
$a = $ap[0];

echo "<table width=480 align=center cellspacing=0><tr>";

if ($a <= $ByPage && $Start == '0')
{

}

elseif ($a > $Start + $ByPage && $Start + $ByPage >= $a || $Start == 0 )
{
	$nom = $Start + $ByPage;
	echo "<td align=right><a class=TNA href=\"jobseekers.php?submit=$submit&order_type=$order_type&Start=$nom\">next</a></td>";
}
elseif ( ($Start < $a && $Start > $ByPage) || ($Start + $ByPage >= $a))
{
	$nom1 = $Start - $ByPage;
	echo "<td align=left><a class=TNA href=\"jobseekers.php?submit=$submit&order_type=$order_type&Start=$nom1\">previous</a></td>";
}
else
{
	$nom1 = $Start - $ByPage;
	echo "<td align=left><a class=TNA href=\"jobseekers.php?submit=$submit&order_type=$order_type&Start=$nom1\">previous</a></td>";	
	$nom = $Start + $ByPage;
	echo "<td align=right><a class=TNA href=\"jobseekers.php?submit=$submit&order_type=$order_type&Start=$nom\">next</a></td>";
}

echo "</tr></table>";
include_once('../footer.php');
exit;
}



?>

<br>
<form method=post>
<table align=center width=400 class=BlackText>
<tr>
	<td colspan=2 align=center class=HeaderClass><font size=3><b>Explore Jobseekers database </b></font><br><br></td>
</tr>
</table>

<table align=center border=1 bordercolor=993300 cellspacing=0 cellpadding=5 width=460>
	<tr>	
			<td align=left><font size=2>Search for a Jobseeker by <b>first name</b>, <b>last name </b>or <b>username</b>:</font><br><br>
        <input type=text name=name><br><br>
	      <input type=radio name=name_type value="fname">First name &nbsp;&nbsp;&nbsp;
	      <input type=radio name=name_type value="lname">Last name&nbsp;&nbsp;&nbsp;
	      <input type=radio name=name_type value="uname">Username<br><br>
	      <input type=submit name=submit value="Search by name">
			</td>
	</tr>
</table>

<br>
<br>

<table align=center border=1 bordercolor=993300 cellspacing=0 cellpadding=5 width=460>
	<tr>
		<td align=left><font size=2>List of all the Jobseekers order by:</font><br><br>
	      <input type=radio name=order_type value="fname">First name&nbsp;&nbsp;&nbsp;
	      <input type=radio name=order_type value="lname">Last name&nbsp;&nbsp;&nbsp;
	      <input type=radio name=order_type value="uname">Username<br><br>
	      <input type=submit name=submit value="List users">
		</td>
	</tr>
</table>
</form>
<? include_once('../footer.php'); ?>